<?php $this->load->view('layout/header'); ?>
<script language="javascript" type="text/javascript" src="/static/bk/datepicker/WdatePicker.js"></script>
<div id="container">
    <form action="" method="post">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_op">
            <tr>
                <td>
                    操作选项：
                    开始时间：
                    <input type="text" name="start_time" class="start_time" onClick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'})" value="<?php echo $start_time; ?>">
                    -
                    <input type="text" name="end_time" class="end_time" onClick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'})" value="<?php echo $end_time; ?>">
                    <input type="submit" value="查询">
                </td>
            </tr>
        </table>
        <!--操作选项结束-->
    </form>
    <!--列表开始-->
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_list" id="TbList">
        <tr class="table_list_title">
            <td style="width: 2%">
                <input type="checkbox" name="checkbox" value="checkbox" onclick="javascript:checkAll(this,'areaid')" />
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=SysLimitID&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                编号
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=LimitName&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                客服账号
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=LimitName&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                接收人
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=LimitName&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                消息类型
            </td>
            <td style="width: 40%" onclick="javascript:GoTo('?OrderKey=LimitValue&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                内容简介
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=AddTime&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                时间
            </td>
            <td style="width: 10%" onclick="javascript:GoTo('?OrderKey=IsClose&AscDesc=desc&txtLimitName=&txtLimitValue=&txtComment=&txtListID=&txtAdminID=&txtAddTime=&drpIsClose=&page=1')" title="点击排序">
                操作
            </td>
        </tr>
        <?php if(!empty($list)){ ?>
            <?php foreach($list as $k=>$v) : ?>
                <tr class="table_list_row_normal">
                    <td style="width: 2%">
                        <input name="areaid" type="checkbox"  value="<?php echo $v['areaid']?>" onclick="javascript:TrColor2('AreaId',1)" />
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['areaid']?>
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['worker']?>
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['openid']?>
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['listid']?>
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['adminname']?>
                    </td>
                    <td style="width: 10%">
                        <?php echo $v['addtime']?>
                    </td>
                    <td style="width: 10%">
                        <?php if($v['childnum'] != 0){ ?>
                            <span style="cursor: pointer;color:blue;" ectype="flex" status="open" fieldid="<?php echo $v['areaid']; ?>">展开</span>
                        <?php } ?>
                        <a href="<?php echo b_url('config/area_child_add/'.$v['areaid'])?>">添加子地区</a>
                    </td>
                </tr>
            <?php endforeach ; ?>
        <?php }else{ ?>
            <tr>
                <td colspan="6">暂无任何记录</td>
            </tr>
        <?php } ?>
    </table>
    <!--列表结束-->
    <!--分页开始-->
    <?php if(isset($last_page)){ ?>
        <a href="/admin.php/wechat/service?&page=<?php echo $last_page; ?>" class="last" onclick="return change_url()">上一页</a>
    <?php } ?>
    <?php if(isset($next_page)){ ?>
        <a href="/admin.php/wechat/service?&page=<?php echo $next_page; ?>" class="next" onclick="return change_url()">下一页</a>
    <?php } ?>
    <!--分页结束-->
</div>
<script src="/static/bk/js/table.js" type="text/javascript"></script>
<?php $this->load->view('layout/footer'); ?>

<script type="text/javascript">

    function change_url(){
        var start_time = $(".start_time").val().trim();
        var end_time = $(".end_time").val().trim();
        var last_href = $(".last").attr('href');
        var next_href = $(".next").attr('href');

        if(last_href != undefined){
            if(start_time != '' && end_time != ''){
                last_href += '&start_time='+start_time+'&end_time='+end_time;
                $('.last').attr('href',last_href);
            }
        }
        if(next_href != undefined){
            if(start_time != '' && end_time != ''){
                next_href += '&start_time='+start_time+'&end_time='+end_time;
                $('.next').attr('href',next_href);
            }
        }

    }
</script>